//
//  ZJOSTeacherView.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/7/20.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJOSTeacherView.h"

@interface ZJOSTeacherView ()
/** imageview */
@property (nonatomic, strong) UIImageView *imageView;
/** name */
@property (nonatomic, strong) UILabel *name;
@end

@implementation ZJOSTeacherView
///高165
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.imageView];
        [self addSubview:self.name];
        
       
    }
    return self;
}


#pragma mark - Setter
- (void)setModel:(ZJSchoolTeacherModel *)model{
    _model = model;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat: @"%@%@",BASEIMAGEURL,model.IMGURL]] placeholderImage:PlaceholderImage];
    self.name.text = model.NAME;
}

#pragma mark - Getters
- (UIImageView *)imageView{
    if (_imageView == nil){
        _imageView = [[UIImageView alloc] initWithFrame: CGRectMake(0, 0, self.width, 134 * [UIScreen zj_screenHScale])];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
        _imageView.clipsToBounds = YES;
        _imageView.backgroundColor = [UIColor randomColor];
    }
    return _imageView;
}

- (UILabel *)name{
    if (_name == nil){
        _name = [[UILabel alloc] initWithFrame:CGRectMake(0, self.imageView.bottom, self.width, self.height - self.imageView.bottom)];
        _name.textColor = [UIColor textGrayColor];
        _name.textAlignment = NSTextAlignmentCenter;
        _name.font = [UIFont systemFontOfSize:16 * [UIScreen zj_textFontScale]];
        _name.text = @"王老师";
    }
    return _name;
}

@end
